#!/bin/sh
DB=butterfly
USR=markus
PW=markus
if [ "-createdb" == "$1" ]; then
    echo "Creating $DB"
	curl --user $USR:$PW -X DELETE http://127.0.0.1:5984/$DB
	curl --user $USR:$PW -X PUT http://127.0.0.1:5984/$DB
	(cd sample; ruby sampledb.rb)
fi

couchapp push http://$USR:$PW@localhost:5984/$DB
ruby testviews.rb
echo "visit http://localhost:5984/$DB/_design/butterfly/index.html"
